import Layout from '@/views/layout.vue'

const routes = [
  { path: '/login', name: 'login', meta: { title: '登录' }, component: () => import('@/views/login.vue') },
  {
    path: '/',
    redirect: '/dashboard',
    component: Layout,
    meta: { title: '首页' },
    children: [
      {
        path: '/dashboard',
        name: 'dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: { title: '后台首页', icon: 'Odometer' },
      },
      {
        path: '/setting',
        name: 'setting',
        component: () => import('@/views/setting/index.vue'),
        meta: { title: '系统设置', icon: 'Setting' },
      },
      {
        path: '/banner',
        name: 'banner',
        meta: { title: '轮播中心', icon: 'Picture', level: 1 },
        component: () => import('@/views/banner/index.vue'),
        // children: [
        //   {
        //     path: ":id(\\d+)",
        //     name: "banner.form",
        //     component: () => import("@/views/banner/form.vue"),
        //     meta: { title: "轮播编辑", hidden: true },
        //   },
        // ]
      },
      {
        path: '/',
        meta: { title: '新闻中心', icon: 'Postcard' },
        children: [
          {
            path: '/news/category',
            name: 'news.category',
            component: () => import('@/views/news/category/index.vue'),
            meta: { title: '新闻分类' },
          },
          {
            path: '/news/category/:id(\\d+)',
            name: 'news.category.form',
            component: () => import('@/views/news/category/form.vue'),
            meta: { title: '新闻编辑', hidden: true },
          },
          {
            path: '/news',
            name: 'news',
            component: () => import('@/views/news/index.vue'),
            meta: { title: '新闻管理' },
          },
          {
            path: '/news/:id(\\d+)',
            name: 'news.form',
            component: () => import('@/views/news/form.vue'),
            meta: { title: '新闻编辑', hidden: true },
          },
        ],
      },
      {
        path: '/about',
        name: 'about',
        component: () => import('@/views/about/index.vue'),
        meta: { title: '关于我们', icon: 'Link' },
      },
    ],
  },
]

export default routes
